
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Monitoring and Metrics · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../styles/website.css">
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="spring-boot-integration.html" />
    
    
    <link rel="prev" href="tuning/command-processing.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../architecture-overview/">
            
                <a href="../architecture-overview/">
            
                    
                    Architecture Overview
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../architecture-overview/ddd-cqrs-concepts.html">
            
                <a href="../architecture-overview/ddd-cqrs-concepts.html">
            
                    
                    DDD & CQRS Concepts
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../architecture-overview/event-sourcing.html">
            
                <a href="../architecture-overview/event-sourcing.html">
            
                    
                    Event Sourcing
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="../architecture-overview/event-driven-microservices.html">
            
                <a href="../architecture-overview/event-driven-microservices.html">
            
                    
                    Event-Driven Microservices
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../axon-server-introduction.html">
            
                <a href="../axon-server-introduction.html">
            
                    
                    Axon Server
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../release-notes/">
            
                <a href="../release-notes/">
            
                    
                    Release Notes
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../release-notes/rn-axon-framework/">
            
                <a href="../release-notes/rn-axon-framework/">
            
                    
                    Axon Framework
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1.1" data-path="../release-notes/rn-axon-framework/rn-af-major-releases.html">
            
                <a href="../release-notes/rn-axon-framework/rn-af-major-releases.html">
            
                    
                    Major Releases
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.1.2" data-path="../release-notes/rn-axon-framework/rn-af-minor-releases.html">
            
                <a href="../release-notes/rn-axon-framework/rn-af-minor-releases.html">
            
                    
                    Minor Releases
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../release-notes/rn-axon-server/">
            
                <a href="../release-notes/rn-axon-server/">
            
                    
                    Axon Server
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.2.1" data-path="../release-notes/rn-axon-server/rn-as-major-releases.html">
            
                <a href="../release-notes/rn-axon-server/rn-as-major-releases.html">
            
                    
                    Major Releases
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2.2" data-path="../release-notes/rn-axon-server/rn-asse-minor-releases.html">
            
                <a href="../release-notes/rn-axon-server/rn-asse-minor-releases.html">
            
                    
                    Minor Releases Standard Edition
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2.3" data-path="../release-notes/rn-axon-server/rn-as-minor-releases.html">
            
                <a href="../release-notes/rn-axon-server/rn-as-minor-releases.html">
            
                    
                    Minor Releases Enterprise Edition
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../release-notes/axon-framework-extensions.html">
            
                <a href="../release-notes/axon-framework-extensions.html">
            
                    
                    Axon Framework Extensions
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">Getting Started</li>
        
        
    
        <li class="chapter " data-level="2.1" data-path="../getting-started/quick-start.html">
            
                <a href="../getting-started/quick-start.html">
            
                    
                    Quick Start
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Axon Framework</li>
        
        
    
        <li class="chapter " data-level="3.1" data-path="introduction.html">
            
                <a href="introduction.html">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2" data-path="messaging-concepts/">
            
                <a href="messaging-concepts/">
            
                    
                    Messaging Concepts
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.2.1" data-path="messaging-concepts/anatomy-message.html">
            
                <a href="messaging-concepts/anatomy-message.html">
            
                    
                    Anatomy of a Message
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.2" data-path="messaging-concepts/message-correlation.html">
            
                <a href="messaging-concepts/message-correlation.html">
            
                    
                    Message Correlation
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.3" data-path="messaging-concepts/message-intercepting.html">
            
                <a href="messaging-concepts/message-intercepting.html">
            
                    
                    Message Intercepting
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.4" data-path="messaging-concepts/supported-parameters-annotated-handlers.html">
            
                <a href="messaging-concepts/supported-parameters-annotated-handlers.html">
            
                    
                    Supported Parameters for Annotated Handlers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.5" data-path="messaging-concepts/exception-handling.html">
            
                <a href="messaging-concepts/exception-handling.html">
            
                    
                    Exception Handling
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.2.6" data-path="messaging-concepts/unit-of-work.html">
            
                <a href="messaging-concepts/unit-of-work.html">
            
                    
                    Unit of Work
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.3" data-path="axon-framework-commands/">
            
                <a href="axon-framework-commands/">
            
                    
                    Commands
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.3.1" data-path="axon-framework-commands/modeling/">
            
                <a href="axon-framework-commands/modeling/">
            
                    
                    Modeling
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.3.1.1" data-path="axon-framework-commands/modeling/aggregate.html">
            
                <a href="axon-framework-commands/modeling/aggregate.html">
            
                    
                    Aggregate
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.1.2" data-path="axon-framework-commands/modeling/multi-entity-aggregates.html">
            
                <a href="axon-framework-commands/modeling/multi-entity-aggregates.html">
            
                    
                    Multi-Entity Aggregates
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.1.3" data-path="axon-framework-commands/modeling/state-stored-aggregates.html">
            
                <a href="axon-framework-commands/modeling/state-stored-aggregates.html">
            
                    
                    State Stored Aggregates
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.1.4" data-path="axon-framework-commands/modeling/aggregate-creation-from-another-aggregate.html">
            
                <a href="axon-framework-commands/modeling/aggregate-creation-from-another-aggregate.html">
            
                    
                    Aggregate Creation from another Aggregate
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.1.5" data-path="axon-framework-commands/modeling/aggregate-polymorphism.html">
            
                <a href="axon-framework-commands/modeling/aggregate-polymorphism.html">
            
                    
                    Aggregate Polymorphism
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.1.6" data-path="axon-framework-commands/modeling/conflict-resolution.html">
            
                <a href="axon-framework-commands/modeling/conflict-resolution.html">
            
                    
                    Conflict Resolution
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.3.2" data-path="axon-framework-commands/command-dispatchers.html">
            
                <a href="axon-framework-commands/command-dispatchers.html">
            
                    
                    Command Dispatchers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.3" data-path="axon-framework-commands/command-handlers.html">
            
                <a href="axon-framework-commands/command-handlers.html">
            
                    
                    Command Handlers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.4" data-path="axon-framework-commands/infrastructure.html">
            
                <a href="axon-framework-commands/infrastructure.html">
            
                    
                    Infrastructure
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.3.5" data-path="axon-framework-commands/configuration.html">
            
                <a href="axon-framework-commands/configuration.html">
            
                    
                    Configuration
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.4" data-path="events/">
            
                <a href="events/">
            
                    
                    Events
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.4.1" data-path="events/event-dispatchers.html">
            
                <a href="events/event-dispatchers.html">
            
                    
                    Event Dispatchers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.2" data-path="events/event-handlers.html">
            
                <a href="events/event-handlers.html">
            
                    
                    Event Handlers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.3" data-path="events/event-processors/">
            
                <a href="events/event-processors/">
            
                    
                    Event Processors
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.4.3.1" data-path="events/event-processors/subscribing.html">
            
                <a href="events/event-processors/subscribing.html">
            
                    
                    Subscribing Event Processors
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.3.2" data-path="events/event-processors/streaming.html">
            
                <a href="events/event-processors/streaming.html">
            
                    
                    Streaming Event Processors
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.4.4" data-path="events/event-bus-and-event-store.html">
            
                <a href="events/event-bus-and-event-store.html">
            
                    
                    Event Bus & Event Store
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.5" data-path="events/event-versioning.html">
            
                <a href="events/event-versioning.html">
            
                    
                    Event Versioning
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.4.6" data-path="events/event-serialization.html">
            
                <a href="events/event-serialization.html">
            
                    
                    Event Serialization
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.5" data-path="queries/">
            
                <a href="queries/">
            
                    
                    Queries
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.5.1" data-path="queries/query-processing.html">
            
                <a href="queries/query-processing.html">
            
                    
                    Query Processing
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.2" data-path="queries/query-dispatchers.html">
            
                <a href="queries/query-dispatchers.html">
            
                    
                    Query Dispatchers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.3" data-path="queries/query-handlers.html">
            
                <a href="queries/query-handlers.html">
            
                    
                    Query Handlers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.4" data-path="queries/implementations.html">
            
                <a href="queries/implementations.html">
            
                    
                    Implementations
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.5.5" data-path="queries/configuration.html">
            
                <a href="queries/configuration.html">
            
                    
                    Configuration
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.6" data-path="sagas/">
            
                <a href="sagas/">
            
                    
                    Sagas
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.6.1" data-path="sagas/implementation.html">
            
                <a href="sagas/implementation.html">
            
                    
                    Implementation
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.6.2" data-path="sagas/associations.html">
            
                <a href="sagas/associations.html">
            
                    
                    Associations
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.6.3" data-path="sagas/infrastructure.html">
            
                <a href="sagas/infrastructure.html">
            
                    
                    Infrastructure
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.7" data-path="deadlines/">
            
                <a href="deadlines/">
            
                    
                    Deadlines
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.7.1" data-path="deadlines/deadline-managers.html">
            
                <a href="deadlines/deadline-managers.html">
            
                    
                    Deadline Managers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.7.2" data-path="deadlines/event-schedulers.html">
            
                <a href="deadlines/event-schedulers.html">
            
                    
                    Event Schedulers
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.8" data-path="testing/">
            
                <a href="testing/">
            
                    
                    Testing
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.8.1" data-path="testing/commands-events.html">
            
                <a href="testing/commands-events.html">
            
                    
                    Commands / Events
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.8.2" data-path="testing/sagas-1.html">
            
                <a href="testing/sagas-1.html">
            
                    
                    Sagas
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3.9" data-path="tuning/">
            
                <a href="tuning/">
            
                    
                    Tuning
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="3.9.1" data-path="tuning/event-snapshots.html">
            
                <a href="tuning/event-snapshots.html">
            
                    
                    Event Snapshots
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.9.2" data-path="tuning/event-processing.html">
            
                <a href="tuning/event-processing.html">
            
                    
                    Event Processing
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.9.3" data-path="tuning/command-processing.html">
            
                <a href="tuning/command-processing.html">
            
                    
                    Command Processing
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter active" data-level="3.10" data-path="monitoring-and-metrics.html">
            
                <a href="monitoring-and-metrics.html">
            
                    
                    Monitoring and Metrics
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.11" data-path="spring-boot-integration.html">
            
                <a href="spring-boot-integration.html">
            
                    
                    Spring Boot Integration
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="3.12" data-path="modules.html">
            
                <a href="modules.html">
            
                    
                    Modules
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Axon Server</li>
        
        
    
        <li class="chapter " data-level="4.1" data-path="../axon-server/introduction.html">
            
                <a href="../axon-server/introduction.html">
            
                    
                    Introduction
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2" data-path="../axon-server/installation/">
            
                <a href="../axon-server/installation/">
            
                    
                    Installation
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.2.1" data-path="../axon-server/installation/local-installation/">
            
                <a href="../axon-server/installation/local-installation/">
            
                    
                    Local Installation
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.2.1.1" data-path="../axon-server/installation/local-installation/axon-server-se.html">
            
                <a href="../axon-server/installation/local-installation/axon-server-se.html">
            
                    
                    Axon Server SE
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2.1.2" data-path="../axon-server/installation/local-installation/axon-server-ee.html">
            
                <a href="../axon-server/installation/local-installation/axon-server-ee.html">
            
                    
                    Axon Server EE
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.2.2" data-path="../axon-server/installation/docker-k8s/">
            
                <a href="../axon-server/installation/docker-k8s/">
            
                    
                    Docker / K8s
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.2.2.1" data-path="../axon-server/installation/docker-k8s/axon-server-se.html">
            
                <a href="../axon-server/installation/docker-k8s/axon-server-se.html">
            
                    
                    Axon Server SE
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.2.2.2" data-path="../axon-server/installation/docker-k8s/axon-server-ee.html">
            
                <a href="../axon-server/installation/docker-k8s/axon-server-ee.html">
            
                    
                    Axon Server EE
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.3" data-path="../axon-server/administration/">
            
                <a href="../axon-server/administration/">
            
                    
                    Administration
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.3.1" data-path="../axon-server/administration/admin-configuration/">
            
                <a href="../axon-server/administration/admin-configuration/">
            
                    
                    Configuration
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.3.1.1" data-path="../axon-server/administration/admin-configuration/configuration.html">
            
                <a href="../axon-server/administration/admin-configuration/configuration.html">
            
                    
                    System Properties
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.1.2" data-path="../axon-server/administration/admin-configuration/command-line-interface.html">
            
                <a href="../axon-server/administration/admin-configuration/command-line-interface.html">
            
                    
                    Command Line Interface
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.1.3" data-path="../axon-server/administration/admin-configuration/rest-api.html">
            
                <a href="../axon-server/administration/admin-configuration/rest-api.html">
            
                    
                    REST API
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.3.2" data-path="../axon-server/administration/monitoring/">
            
                <a href="../axon-server/administration/monitoring/">
            
                    
                    Monitoring
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.3.2.1" data-path="../axon-server/administration/monitoring/actuator-endpoints.html">
            
                <a href="../axon-server/administration/monitoring/actuator-endpoints.html">
            
                    
                    Actuator Endpoints
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.2.2" data-path="../axon-server/administration/monitoring/grpc-metrics.html">
            
                <a href="../axon-server/administration/monitoring/grpc-metrics.html">
            
                    
                    gRPC Metrics
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.2.3" data-path="../axon-server/administration/monitoring/heartbeat-monitoring.html">
            
                <a href="../axon-server/administration/monitoring/heartbeat-monitoring.html">
            
                    
                    Heartbeat Monitoring
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.3.3" data-path="../axon-server/administration/clustering.html">
            
                <a href="../axon-server/administration/clustering.html">
            
                    
                    Clusters
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.4" data-path="../axon-server/administration/replication-groups.html">
            
                <a href="../axon-server/administration/replication-groups.html">
            
                    
                    Replication Groups
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.5" data-path="../axon-server/administration/multi-context.html">
            
                <a href="../axon-server/administration/multi-context.html">
            
                    
                    Multi-Context
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.6" data-path="../axon-server/administration/tagging.html">
            
                <a href="../axon-server/administration/tagging.html">
            
                    
                    Tagging
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.7" data-path="../axon-server/administration/backup-and-messaging-only-nodes.html">
            
                <a href="../axon-server/administration/backup-and-messaging-only-nodes.html">
            
                    
                    Backup and Messaging-only Nodes
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.8" data-path="../axon-server/administration/backups.html">
            
                <a href="../axon-server/administration/backups.html">
            
                    
                    Backups
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.9" data-path="../axon-server/administration/recovery.html">
            
                <a href="../axon-server/administration/recovery.html">
            
                    
                    Recovery
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.10" data-path="../axon-server/administration/plugins.html">
            
                <a href="../axon-server/administration/plugins.html">
            
                    
                    Plugins
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.3.11" data-path="../axon-server/administration/error-codes.html">
            
                <a href="../axon-server/administration/error-codes.html">
            
                    
                    Error Codes
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.4" data-path="../axon-server/security/">
            
                <a href="../axon-server/security/">
            
                    
                    Security
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.4.1" data-path="../axon-server/security/ssl.html">
            
                <a href="../axon-server/security/ssl.html">
            
                    
                    SSL
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4.2" data-path="../axon-server/security/access-control.html">
            
                <a href="../axon-server/security/access-control.html">
            
                    
                    Access Control
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4.3" data-path="../axon-server/security/access-control-se.html">
            
                <a href="../axon-server/security/access-control-se.html">
            
                    
                    Access Control - Standard Edition
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4.4" data-path="../axon-server/security/access-control-ee.html">
            
                <a href="../axon-server/security/access-control-ee.html">
            
                    
                    Access Control - Enterprise Edition
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4.5" data-path="../axon-server/security/access-control-clients.html">
            
                <a href="../axon-server/security/access-control-clients.html">
            
                    
                    Access Control - Client Applications
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4.6" data-path="../axon-server/security/access-control-cli.html">
            
                <a href="../axon-server/security/access-control-cli.html">
            
                    
                    Access Control - CLI
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4.7" data-path="../axon-server/security/access-control-api.html">
            
                <a href="../axon-server/security/access-control-api.html">
            
                    
                    Access Control - API
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4.8" data-path="../axon-server/security/access-control-ldap.html">
            
                <a href="../axon-server/security/access-control-ldap.html">
            
                    
                    Access Control - LDAP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.4.9" data-path="../axon-server/security/access-control-oauth2.html">
            
                <a href="../axon-server/security/access-control-oauth2.html">
            
                    
                    Access Control - OAuth 2.0
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.5" data-path="../axon-server/performance/">
            
                <a href="../axon-server/performance/">
            
                    
                    Performance
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.5.1" data-path="../axon-server/performance/tuning-event-processing.html">
            
                <a href="../axon-server/performance/tuning-event-processing.html">
            
                    
                    Event Segments
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.5.2" data-path="../axon-server/performance/flow-control.html">
            
                <a href="../axon-server/performance/flow-control.html">
            
                    
                    Flow Control
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="4.6" data-path="../axon-server/migration/">
            
                <a href="../axon-server/migration/">
            
                    
                    Migration
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="4.6.1" data-path="../axon-server/migration/standard-to-enterprise-edition.html">
            
                <a href="../axon-server/migration/standard-to-enterprise-edition.html">
            
                    
                    Standard to Enterprise Edition
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="4.6.2" data-path="../axon-server/migration/non-axon-server-to-axon-server.html">
            
                <a href="../axon-server/migration/non-axon-server-to-axon-server.html">
            
                    
                    Non-Axon Server to Axon Server
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    
        
        <li class="header">Extensions</li>
        
        
    
        <li class="chapter " data-level="5.1" data-path="../extensions/spring-amqp.html">
            
                <a href="../extensions/spring-amqp.html">
            
                    
                    Spring AMQP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.2" data-path="../extensions/jgroups.html">
            
                <a href="../extensions/jgroups.html">
            
                    
                    JGroups
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.3" data-path="../extensions/kafka.html">
            
                <a href="../extensions/kafka.html">
            
                    
                    Kafka
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.4" data-path="../extensions/kotlin.html">
            
                <a href="../extensions/kotlin.html">
            
                    
                    Kotlin
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.5" data-path="../extensions/mongo.html">
            
                <a href="../extensions/mongo.html">
            
                    
                    Mongo
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.6" data-path="../extensions/reactor/reactor.html">
            
                <a href="../extensions/reactor/reactor.html">
            
                    
                    Reactor
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="5.6.1" data-path="../extensions/reactor/reactive-gateways/reactive-gateways.html">
            
                <a href="../extensions/reactor/reactive-gateways/reactive-gateways.html">
            
                    
                    Reactor Gateways
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="5.7" data-path="../extensions/spring-cloud.html">
            
                <a href="../extensions/spring-cloud.html">
            
                    
                    Spring Cloud
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="5.8" data-path="../extensions/tracing.html">
            
                <a href="../extensions/tracing.html">
            
                    
                    Tracing
            
                </a>
            

            
        </li>
    

    
        
        <li class="header">Appendices</li>
        
        
    
        <li class="chapter " data-level="6.1" data-path="../appendices/rdbms-tuning.html">
            
                <a href="../appendices/rdbms-tuning.html">
            
                    
                    A. RDBMS Tuning
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.2" data-path="../appendices/message-handler-tuning/">
            
                <a href="../appendices/message-handler-tuning/">
            
                    
                    B. Message Handler Tuning
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.2.1" data-path="../appendices/message-handler-tuning/parameter-resolvers.html">
            
                <a href="../appendices/message-handler-tuning/parameter-resolvers.html">
            
                    
                    Parameter Resolvers
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.2.2" data-path="../appendices/message-handler-tuning/handler-enhancers.html">
            
                <a href="../appendices/message-handler-tuning/handler-enhancers.html">
            
                    
                    Handler Enhancers
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="6.3" data-path="../appendices/meta-annotations.html">
            
                <a href="../appendices/meta-annotations.html">
            
                    
                    C. Meta Annotations
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.4" data-path="../appendices/identifier-generation.html">
            
                <a href="../appendices/identifier-generation.html">
            
                    
                    D. Identifier Generation
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="6.5" data-path="../appendices/query-reference.html">
            
                <a href="../appendices/query-reference.html">
            
                    
                    E. Axon Server Query Language
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >Monitoring and Metrics</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="monitoring-and-metrics">Monitoring and Metrics</h1>
<p>The ability to monitor and measure what is going on is very important. Especially in a location transparent environment like an Axon application it is very important to be able to trace your message and check the ingestion rate of it.&#x200C;</p>
<h2 id="monitoring-">Monitoring <a id="monitoring"></a></h2>
<p>&#x200C;</p>
<p>Monitoring a message centric application will require you to be able to see where your messages are at a given point in time. This translates to being able to track your commands, events and queries from one component to another in an Axon application.&#x200C;</p>
<h3 id="correlation-data-">Correlation Data <a id="correlation-data"></a></h3>
<p>One import aspect in regards to this is tracing a given message. To that end the framework provides the <code>CorrelationDataProvider</code>, as described briefly <a href="messaging-concepts/message-intercepting.html">here</a>. This interface and its implementations provide you the means to populate the meta-data of your messages with specific fields, like a &apos;trace-id&apos;, &apos;correlation-id&apos; or any other field you might be interested in.&#x200C;</p>
<p>For configuring the <code>MessageOriginProvider</code> you can do the following:</p>
<p> tabs 
 tab title=&quot;Axon Configuration API&quot; </p>
<pre><code class="lang-java"><span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MonitoringConfiguration</span> </span>{

    <span class="hljs-function"><span class="hljs-keyword">public</span> Configurer <span class="hljs-title">buildConfigurer</span><span class="hljs-params">()</span> </span>{
        <span class="hljs-keyword">return</span> DefaultConfigurer.defaultConfiguration();
    }

    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">configureMessageOriginProvider</span><span class="hljs-params">(Configurer configurer)</span> </span>{
        configurer.configureCorrelationDataProviders(configuration -&gt; {
            List&lt;CorrelationDataProvider&gt; correlationDataProviders = <span class="hljs-keyword">new</span> ArrayList&lt;&gt;();
            correlationDataProviders.add(<span class="hljs-keyword">new</span> MessageOriginProvider());
            <span class="hljs-keyword">return</span> correlationDataProviders;
        });
    }

}
</code></pre>
<p> endtab </p>
<p> tab title=&quot;Spring Boot AutoConfiguration&quot; </p>
<pre><code class="lang-text">public class MonitoringConfiguration {

    // When using Spring Boot, simply defining a CorrelationDataProvider bean is sufficient
    public CorrelationDataProvider messageOriginProvider() {
        return new MessageOriginProvider();
    }

}
</code></pre>
<p> endtab 
 endtabs </p>
<h3 id="interceptor-logging-">Interceptor Logging <a id="interceptor-logging"></a></h3>
<p>Another good approach to track the flow of messages throughout an Axon application is by setting up the right interceptors in your application. There are two flavors of interceptors, the Dispatch and Handler Interceptors (as discussed <a href="messaging-concepts/message-intercepting.html">here</a>), which intercept a message prior to publishing (Dispatch Interceptor) or while it is being handled (Handler Interceptor). The interceptor mechanism lends itself quite nicely to introduce a way to consistently log when a message is being dispatched/handled. The <code>LoggingInterceptor</code> is an out of the box solution to log any type of message to SLF4J, but also provides a simple overridable template to set up your own desired logging format. We refer to the command, event and query sections for the specifics on how to configure message interceptors.&#x200C;</p>
<h3 id="event-tracker-status-">Event Tracker Status <a id="event-tracker-status"></a></h3>
<p>Since <a href="events/event-processors/streaming.html#token-store">Tracking Tokens</a> &quot;track&quot; the progress of a given Tracking Event Processor, they provide a sensible monitoring hook in any Axon application. Such a hook proves its usefulness when we want to rebuild our view model and we want to check when the processor has caught up with all the events.</p>
<p>To that end the <code>TrackingEventProcessor</code> exposes the <code>processingStatus()</code> method. It returns a map where the key is the segment identifier and the value is an &quot;Event Tracker Status&quot;. The Event Tracker Status exposes a couple of metrics:</p>
<ul>
<li>The <code>Segment</code> it reflects the status of.</li>
<li>A boolean through <code>isCaughtUp()</code> specifying whether it is caught up with the Event Stream.</li>
<li><p>A boolean through <code>isReplaying()</code> specifying whether the given Segment is <a href="events/event-processors/streaming.html#replaying-events">replaying</a>.</p>
</li>
<li><p>A boolean through <code>isMerging()</code> specifying whether the given Segment is <a href="events/event-processors/streaming.html#splitting-and-merging-segments">merging</a>.</p>
</li>
<li>The <code>TrackingToken</code> of the given Segment.</li>
<li>A boolean through <code>isErrorState()</code> specifying whether the Segment is in an error state.</li>
<li>An optional <code>Throwable</code> if the Event Tracker reached an error state.</li>
<li>An optional <code>Long</code> through <code>getCurrentPosition</code> defining the current position of the <code>TrackingToken</code>.</li>
<li>An optional <code>Long</code> through <code>getResetPosition</code> defining the position at reset of the <code>TrackingToken</code>.
This field will be <code>null</code> in case the <code>isReplaying()</code> returns <code>false</code>.
It is possible to derive an estimated duration of replaying by comparing the current position with this field.</li>
<li>An optional <code>Long</code> through <code>mergeCompletedPosition()</code> defining the position on the <code>TrackingToken</code> when merging will be completed.
This field will be <code>null</code> in case the <code>isMerging()</code> returns <code>false</code>.
It is possible to derive an estimated duration of merging by comparing the current position with this field.</li>
</ul>
<p>Some scenarios call for a means to react on <em>when</em> the status&apos; of a processor changes.
For example, whenever the status switches from replay being <code>true</code> or <code>false</code>.
To that end, a <code>EventTrackerStatusChangeListener</code> can be configured through the <code>TrackingEventProcessorConfiguration</code> for a <code>TrackingEventProcessor</code>.</p>
<p>The <code>EventTrackerStatusChangeListener</code> is a functional interface defining an <code>onEventTrackerStatusChange(Map&lt;Integer, EventTrackerStatus&gt;)</code> method, which will be invoked by the <code>TrackingEventProcessor</code> whenever there is a significant change in any one of the <code>EventTrackerStatus</code> objects.
The collection of integer to <code>EventTrackerStatus</code> provides the status&apos; which have caused the change listener to be invoked.
This thus allows you to check the given <code>EventTrackerStatus</code>&apos; to react accordingly.</p>
<p>Know that by default, the processor will only invoke the change listener if any of the boolean fields has changed.
If it is required to react on the position changes as well, you can provide a <code>EventTrackerStatusChangeListener</code> which overrides the <code>validatePositions</code> method to return <code>true</code>.
Do note that this means the change listener will be invoked <em>often</em>, as it is expected to handle lots of events.   </p>
<h2 id="metrics-">Metrics <a id="metrics"></a></h2>
<p>Interesting metrics in a message centric system come in several forms and flavors, like count, capacity and latency for example. Axon Framework allows you to retrieve such measurements through the use of the <code>axon-metrics</code> or <code>axon-micrometer</code> module. With these modules you can register a number of <code>MessageMonitor</code> implementations to your messaging components, like the <a href="axon-framework-commands/command-dispatchers.html#the-command-bus"><code>CommandBus</code></a>, <a href="events/event-bus-and-event-store.html#event-bus"><code>EventBus</code></a>, <a href="queries/query-dispatchers.html#the-query-bus-and-query-gateway"><code>QueryBus</code></a> and <a href="events/event-processors/"><code>EventProcessors</code></a>.</p>
<p><code>axon-metrics</code> module uses <a href="https://metrics.dropwizard.io/" target="_blank">Dropwizard Metrics</a> for registering the measurements correctly. That means that <code>MessageMonitors</code> are registered against the Dropwizard <code>MetricRegistry</code>.&#x200C;</p>
<p><code>axon-micrometer</code> module uses <a href="https://micrometer.io/" target="_blank">Micrometer</a> which is a dimensional-first metrics collection facade whose aim is to allow you to time, count, and gauge your code with a vendor neutral API. That means that <code>MessageMonitors</code> are registered against the Micrometer <code>MeterRegistry</code>.&#x200C;</p>
<p>The following monitor implementations are currently provided:&#x200C;</p>
<ol>
<li><p><code>CapacityMonitor</code> - Measures message capacity by keeping track of the total time spent on message handling compared to total time it is active.</p>
<p>This returns a number between 0 and n number of threads. Thus, if there are 4 threads working, the maximum capacity is 4 if every thread is active 100% of the time.</p>
</li>
<li><p><code>EventProcessorLatencyMonitor</code> - Measures the difference in message timestamps between the last ingested and the last processed event message.</p>
</li>
<li><code>MessageCountingMonitor</code> - Counts the number of ingested, successful, failed, ignored and processed messages.</li>
<li><code>MessageTimerMonitor</code> - Keeps a timer for all successful, failed and ignored messages, as well as an overall timer for all three combined.</li>
<li><code>PayloadTypeMessageMonitorWrapper</code> - A special <code>MessageMonitor</code> implementation which allows setting a monitor per message type instead of per message publishing/handling component.</li>
</ol>
<p>&#x200C;</p>
<p>You are free to configure any combination of <code>MessageMonitors</code> through constructors on your messaging components, simply by using the Configuration API. The <code>GlobalMetricRegistry</code> contained in the <code>axon-metrics</code> and <code>axon-micrometer</code> modules provides a set of sensible defaults per type of messaging component. The following example shows you how to configure default metrics for your message handling components:&#x200C;</p>
<h3 id="dropwizard">Dropwizard</h3>
<p> tabs 
 tab title=&quot;Axon Configuration API&quot; </p>
<pre><code class="lang-java"><span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MetricsConfiguration</span> </span>{

    <span class="hljs-function"><span class="hljs-keyword">public</span> Configurer <span class="hljs-title">buildConfigurer</span><span class="hljs-params">()</span> </span>{
        <span class="hljs-keyword">return</span> DefaultConfigurer.defaultConfiguration();
    }

    <span class="hljs-comment">// The MetricRegistry is a class from the Dropwizard Metrics framework</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">configureDefaultMetrics</span><span class="hljs-params">(Configurer configurer, MetricRegistry metricRegistry)</span> </span>{
        GlobalMetricRegistry globalMetricRegistry = <span class="hljs-keyword">new</span> GlobalMetricRegistry(metricRegistry);
        <span class="hljs-comment">// We register the default monitors to our messaging components by doing the following</span>
        globalMetricRegistry.registerWithConfigurer(configurer);
    }
}
</code></pre>
<p> endtab </p>
<p> tab title=&quot;Spring Boot AutoConfiguration&quot; </p>
<pre><code class="lang-text"># The default value is `true`. Thus you will have Metrics configured if `axon-metrics` and `io.dropwizard.metrics` are on your classpath.
axon.metrics.auto-configuration.enabled=true
</code></pre>
<p> endtab 
 endtabs </p>
<h3 id="micrometer">Micrometer</h3>
<p> tabs 
 tab title=&quot;Axon Configuration API - Without Tags&quot; </p>
<pre><code class="lang-java"><span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MetricsConfiguration</span> </span>{

    <span class="hljs-function"><span class="hljs-keyword">public</span> Configurer <span class="hljs-title">buildConfigurer</span><span class="hljs-params">()</span> </span>{
        <span class="hljs-keyword">return</span> DefaultConfigurer.defaultConfiguration();
    }

    <span class="hljs-comment">// The MeterRegistry is a class from the Micrometer library</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">configureDefaultMetrics</span><span class="hljs-params">(Configurer configurer, MeterRegistry meterRegistry)</span> </span>{
        GlobalMetricRegistry globalMetricRegistry = <span class="hljs-keyword">new</span> GlobalMetricRegistry(meterRegistry);
        globalMetricRegistry.registerWithConfigurer(configurer);
    }
}
</code></pre>
<p> endtab </p>
<p> tab title=&quot;Axon Configuration API - With Tags&quot; </p>
<pre><code class="lang-java"><span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MetricsConfiguration</span> </span>{

    <span class="hljs-function"><span class="hljs-keyword">public</span> Configurer <span class="hljs-title">buildConfigurer</span><span class="hljs-params">()</span> </span>{
        <span class="hljs-keyword">return</span> DefaultConfigurer.defaultConfiguration();
    }

    <span class="hljs-comment">// The MeterRegistry is a class from the Micrometer library</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> <span class="hljs-keyword">void</span> <span class="hljs-title">configureDefaultMetrics</span><span class="hljs-params">(Configurer configurer, MeterRegistry meterRegistry)</span> </span>{
        GlobalMetricRegistry globalMetricRegistry = <span class="hljs-keyword">new</span> GlobalMetricRegistry(meterRegistry);
        globalMetricRegistry.registerWithConfigurerWithDefaultTags(configurer);
    }
}
</code></pre>
<p> endtab </p>
<p> tab title=&quot;Spring Boot AutoConfiguration - Without Tags&quot; </p>
<pre><code class="lang-text"># The default value is `true`. 
# Thus you will have Metrics configured if `axon-micrometer` and 
#  appropriate metric implementation (for example: `micrometer-registry-prometheus`) are on your classpath.
axon.metrics.auto-configuration.enabled=true

# Spring Boot metrics enabled
management.endpoint.metrics.enabled=true

# Spring Boot (Prometheus) endpoint (`/actuator/prometheus`) enabled and exposed
management.metrics.export.prometheus.enabled=true
management.endpoint.prometheus.enabled=true
</code></pre>
<p> endtab 
 tab title=&quot;Spring Boot AutoConfiguration - With Tags&quot; </p>
<pre><code class="lang-text"># The default value is `true`. 
# Thus you will have Metrics configured if `axon-micrometer` and 
#  appropriate metric implementation (for example: `micrometer-registry-prometheus`) are on your classpath.
axon.metrics.auto-configuration.enabled=true

# The default value is `false`. 
# By enabling this property you will have message (event, command, query)
#   payload type set as a micrometer tag/dimension by default. 
# Additionally, the processor name will be a tag/dimension instead of it being part of the metric name.
axon.metrics.micrometer.dimensional=true

# Spring Boot metrics enabled
management.endpoint.metrics.enabled=true

# Spring Boot (Prometheus) endpoint (`/actuator/prometheus`) enabled and exposed
management.metrics.export.prometheus.enabled=true
management.endpoint.prometheus.enabled=true
</code></pre>
<p> endtab 
 endtabs </p>
<p>The scenario might occur that more fine-grained control over which <code>MessageMonitor</code> instance are defined is necessary.
The following snippet provides as sample if you want to have more specific metrics on any of the message handling components:</p>
<pre><code class="lang-java"><span class="hljs-comment">// Java (Spring Boot Configuration) - Micrometer example</span>
<span class="hljs-meta">@Configuration</span>
<span class="hljs-keyword">public</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">MetricsConfig</span> </span>{

    <span class="hljs-meta">@Bean</span>
    <span class="hljs-function"><span class="hljs-keyword">public</span> ConfigurerModule <span class="hljs-title">metricConfigurer</span><span class="hljs-params">(MeterRegistry meterRegistry)</span> </span>{
        <span class="hljs-keyword">return</span> configurer -&gt; {
            instrumentEventStore(meterRegistry, configurer);
            instrumentEventProcessors(meterRegistry, configurer);
            instrumentCommandBus(meterRegistry, configurer);
            instrumentQueryBus(meterRegistry, configurer);
        };
    }

    <span class="hljs-function"><span class="hljs-keyword">private</span> <span class="hljs-keyword">void</span> <span class="hljs-title">instrumentEventStore</span><span class="hljs-params">(MeterRegistry meterRegistry, Configurer configurer)</span> </span>{
        MessageMonitorFactory messageMonitorFactory = (configuration, componentType, componentName) -&gt; {
            MessageCountingMonitor messageCounter = MessageCountingMonitor.buildMonitor(
                    componentName, meterRegistry,
                    message -&gt; Tags.of(TagsUtil.PAYLOAD_TYPE_TAG, message.getPayloadType().getSimpleName())
                                   .and(message.getMetaData().entrySet().stream()
                                               .map(s -&gt; Tag.of(s.getKey(), s.getValue().toString()))
                                               .collect(Collectors.toList()))
            );
            <span class="hljs-comment">// Naming the Timer monitor/meter with the name of the component (eventStore)</span>
            <span class="hljs-comment">// Registering the Timer with custom tags: payloadType.</span>
            MessageTimerMonitor messageTimer = MessageTimerMonitor.buildMonitor(
                    componentName, meterRegistry,
                    message -&gt; Tags.of(TagsUtil.PAYLOAD_TYPE_TAG, message.getPayloadType().getSimpleName())
            );
            <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> MultiMessageMonitor&lt;&gt;(messageCounter, messageTimer);
        };
        configurer.configureMessageMonitor(EventStore.class, messageMonitorFactory);
    }

    <span class="hljs-function"><span class="hljs-keyword">private</span> <span class="hljs-keyword">void</span> <span class="hljs-title">instrumentEventProcessors</span><span class="hljs-params">(MeterRegistry meterRegistry, Configurer configurer)</span> </span>{
        MessageMonitorFactory messageMonitorFactory = (configuration, componentType, componentName) -&gt; {

            <span class="hljs-comment">// Naming the Counter monitor/meter with the fixed name `eventProcessor`.</span>
            <span class="hljs-comment">// Registering the Counter with custom tags: payloadType and processorName.</span>
            MessageCountingMonitor messageCounter = MessageCountingMonitor.buildMonitor(
                    <span class="hljs-string">&quot;eventProcessor&quot;</span>, meterRegistry,
                    message -&gt; Tags.of(
                            TagsUtil.PAYLOAD_TYPE_TAG, message.getPayloadType().getSimpleName(),
                            TagsUtil.PROCESSOR_NAME_TAG, componentName
                    )
            );
            <span class="hljs-comment">// Naming the Timer monitor/meter with the fixed name `eventProcessor`.</span>
            <span class="hljs-comment">// Registering the Timer with custom tags: payloadType and processorName.</span>
            MessageTimerMonitor messageTimer = MessageTimerMonitor.buildMonitor(
                    <span class="hljs-string">&quot;eventProcessor&quot;</span>, meterRegistry,
                    message -&gt; Tags.of(
                            TagsUtil.PAYLOAD_TYPE_TAG, message.getPayloadType().getSimpleName(),
                            TagsUtil.PROCESSOR_NAME_TAG, componentName
                    )
            );
            <span class="hljs-comment">// Naming the Capacity/Gauge monitor/meter with the fixed name `eventProcessor`.</span>
            <span class="hljs-comment">// Registering the Capacity/Gauge with custom tags: payloadType and processorName.</span>
            CapacityMonitor capacityMonitor1Minute = CapacityMonitor.buildMonitor(
                    <span class="hljs-string">&quot;eventProcessor&quot;</span>, meterRegistry,
                    message -&gt; Tags.of(
                            TagsUtil.PAYLOAD_TYPE_TAG, message.getPayloadType().getSimpleName(),
                            TagsUtil.PROCESSOR_NAME_TAG, componentName
                    )
            );

            <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> MultiMessageMonitor&lt;&gt;(messageCounter, messageTimer, capacityMonitor1Minute);
        };
        configurer.configureMessageMonitor(TrackingEventProcessor.class, messageMonitorFactory);
    }

    <span class="hljs-function"><span class="hljs-keyword">private</span> <span class="hljs-keyword">void</span> <span class="hljs-title">instrumentCommandBus</span><span class="hljs-params">(MeterRegistry meterRegistry, Configurer configurer)</span> </span>{
        MessageMonitorFactory messageMonitorFactory = (configuration, componentType, componentName) -&gt; {
            MessageCountingMonitor messageCounter = MessageCountingMonitor.buildMonitor(
                    componentName, meterRegistry,
                    message -&gt; Tags.of(
                            TagsUtil.PAYLOAD_TYPE_TAG, message.getPayloadType().getSimpleName(),
                            <span class="hljs-string">&quot;messageId&quot;</span>, message.getIdentifier()
                    )
            );
            MessageTimerMonitor messageTimer = MessageTimerMonitor.buildMonitor(
                    componentName, meterRegistry,
                    message -&gt; Tags.of(TagsUtil.PAYLOAD_TYPE_TAG, message.getPayloadType().getSimpleName())
            );

            CapacityMonitor capacityMonitor1Minute = CapacityMonitor.buildMonitor(
                    componentName, meterRegistry,
                    message -&gt; Tags.of(TagsUtil.PAYLOAD_TYPE_TAG, message.getPayloadType().getSimpleName())
            );

            <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> MultiMessageMonitor&lt;&gt;(messageCounter, messageTimer, capacityMonitor1Minute);
        };
        configurer.configureMessageMonitor(CommandBus.class, messageMonitorFactory);
    }

    <span class="hljs-function"><span class="hljs-keyword">private</span> <span class="hljs-keyword">void</span> <span class="hljs-title">instrumentQueryBus</span><span class="hljs-params">(MeterRegistry meterRegistry, Configurer configurer)</span> </span>{
        MessageMonitorFactory messageMonitorFactory = (configuration, componentType, componentName) -&gt; {
            MessageCountingMonitor messageCounter = MessageCountingMonitor.buildMonitor(
                    componentName, meterRegistry,
                    message -&gt; Tags.of(
                            TagsUtil.PAYLOAD_TYPE_TAG, message.getPayloadType().getSimpleName(),
                            <span class="hljs-string">&quot;messageId&quot;</span>, message.getIdentifier()
                    )
            );
            MessageTimerMonitor messageTimer = MessageTimerMonitor.buildMonitor(
                    componentName, meterRegistry,
                    message -&gt; Tags.of(TagsUtil.PAYLOAD_TYPE_TAG, message.getPayloadType().getSimpleName())
            );
            CapacityMonitor capacityMonitor1Minute = CapacityMonitor.buildMonitor(
                    componentName, meterRegistry,
                    message -&gt; Tags.of(TagsUtil.PAYLOAD_TYPE_TAG, message.getPayloadType().getSimpleName())
            );

            <span class="hljs-keyword">return</span> <span class="hljs-keyword">new</span> MultiMessageMonitor&lt;&gt;(messageCounter, messageTimer, capacityMonitor1Minute);
        };
        configurer.configureMessageMonitor(QueryBus.class, messageMonitorFactory);
    }
}
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="tuning/command-processing.html" class="navigation navigation-prev " aria-label="Previous page: Command Processing">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="spring-boot-integration.html" class="navigation navigation-next " aria-label="Next page: Spring Boot Integration">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Monitoring and Metrics","level":"3.10","depth":1,"next":{"title":"Spring Boot Integration","level":"3.11","depth":1,"path":"axon-framework/spring-boot-integration.md","ref":"axon-framework/spring-boot-integration.md","articles":[]},"previous":{"title":"Command Processing","level":"3.9.3","depth":2,"path":"axon-framework/tuning/command-processing.md","ref":"axon-framework/tuning/command-processing.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"axon-framework/monitoring-and-metrics.md","mtime":"2021-09-13T08:33:06.074Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2021-09-13T08:33:36.904Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

